<?php
include('includes/functions.php');
include '/home/gwstuden/public_html/twitter/EpiCurl.php';
include '/home/gwstuden/public_html/twitter/EpiOAuth.php';
include '/home/gwstuden/public_html/twitter/EpiTwitter.php';

$events = get_allday_events(date('d'),date('m'),date('Y'));
if (sizeof($events)==0) exit();

$output = "";
foreach ($events as $event) {
if (strlen($output)>0) $output .= ", ";
	$output .= $event['title'];
}
$output = "Today on campus: " . $output;
$url = " - " . getSmallLink('http://www.gwstudentassociation.com/calendar/' . date('Y') . '/' . date('m') . '/' . date('d') . '/'); 

$chars = 140 - strlen($url);
if (strlen($output)>$chars) $output = substr($output,0,$chars-4) . "...";
$output .= $url;

$twitterObj = new EpiTwitter($consumer_key, $consumer_secret, $userToken, $userSecret);
$userInfo = $twitterObj->get_accountVerify_credentials();
$update = $twitterObj->post_statusesUpdate(array('status' => stripslashes($output)));
$update->response;

?>